#!/bin/bash
function fmake {
  echo "$1" | sed "s/\.ml/\.byte/" | xargs make
}
function frun {
  FN=$(echo "$1" | sed "s/\.ml/\.byte/" | sed "s/^.*\//\.\//")
  sh -c "$FN $2"
}
function copy {
  FN=$(echo "$1" | sed "s/\.ml/\.byte/" | sed "s/^.*\///")
  sh -c "cp $FN bin/"	 
}
case $1 in
c) fmake $2;; 
r) frun $2 $3;;
cp) copy $2;;
*)
  fmake $1 
  copy $1
  frun $1 $2;;
esac
